Skip to content

Comments

Partial statistics docs and settings#22087

Merged
taroface merged 8 commits intomainfrom
partial-stats
Feb 20, 2026
Merged

Partial statistics docs and settings#22087
taroface merged 8 commits intomainfrom
partial-stats

Conversation

@taroface
Copy link
Contributor

@taroface taroface commented Jan 8, 2026

DOC-14809
DOC-11635
DOC-10969
DOC-10915
DOC-12760

Improve our partial statistics docs as follows:

  • Document partial statistics on the optimizer page
  • Add partial stats examples to CREATE STATISTICS page
  • Document missing session settings and table storage parameters
  • Reorganize how table stats (full, partial, forecasted) are presented on the optimizer page

These updates apply to 23.2-26.1, according to the following feature timeline (please call out if incorrect):

Version Feature / Milestone Default Behavior Updated Settings
≤ v24.2 Manual partial statistics available but disabled by default Partial stats must be explicitly enabled; optimizer has no merged partial stats support enable_create_stats_using_extremes = off (session)
v24.3 Manual partial statistics via USING EXTREMES enabled by default Optimizer can use partial stats (off by default) enable_create_stats_using_extremes = on (session); optimizer_use_merged_partial_statistics = off (session)
v25.1 Automatic partial statistics collection introduced Automatic partial stats collection on by default sql.stats.automatic_partial_collection.enabled = true; sql.stats.automatic_partial_collection.min_stale_rows = 100; sql.stats.automatic_partial_collection.fraction_stale_rows = 0.05; table-level equivalents
v25.2 Optimizer uses merged partial statistics by default; independent full/partial control Optimizer merges partial stats by default; full and partial auto-collection independently configurable optimizer_use_merged_partial_statistics = on; sql.stats.automatic_partial_collection.enabled = true; sql.stats.automatic_full_collection.enabled = true; table-level equivalents
v25.4 Predicate-based partial statistics (WHERE) Partial statistics can be manually collected using WHERE

Docs to review (v26.1; please use the version dropdown menu to change versions):

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit 6fa129f
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-api-docs/deploys/69989c6fc942f20008423810

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit 6fa129f
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-interactivetutorials-docs/deploys/69989c6f0ab1b700081605ed

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Files changed:

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for cockroachdb-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 38dbdab
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/695fd90114fc6100089138af

@netlify
Copy link

netlify bot commented Jan 8, 2026

Netlify Preview

Name Link
🔨 Latest commit 6fa129f
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/69989c6f4c1a6d00071d0617
😎 Deploy Preview https://deploy-preview-22087--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@taroface taroface force-pushed the partial-stats branch 2 times, most recently from 8cf6c99 to c477e0e Compare January 8, 2026 17:57
@taroface taroface requested a review from rytaft January 9, 2026 19:01
Copy link
Contributor

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for all this work! Just a few comments.

@taroface
Copy link
Contributor Author

taroface commented Feb 2, 2026

@rytaft TFTR and sorry I took a while to get back to this! I revised per your feedback; could you please have another look?

@taroface taroface requested a review from rytaft February 2, 2026 17:17
Copy link
Contributor

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

Copy link
Contributor

@florence-crl florence-crl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending suggestions.

Please apply suggestions from earlier versions to later versions as applicable.

In v25.4, should the CREATE STATISTICS syntax include WHERE?

| `sql_stats_automatic_collection_enabled` | Enable automatic collection of [full]({% link {{ page.version.version }}/cost-based-optimizer.md %}#full-statistics) and [partial]({% link {{ page.version.version }}/cost-based-optimizer.md %}#partial-statistics) statistics for this table. | Boolean | `true` |
| `sql_stats_automatic_collection_min_stale_rows` | Minimum number of stale rows in this table that will trigger a full statistics refresh. | Integer | 500 |
| `sql_stats_automatic_collection_fraction_stale_rows` | Fraction of stale rows in this table that will trigger a full statistics refresh. | Float | 0.2 |
| `sql_stats_automatic_full_collection_enabled` | {% include_cached new-in.html version="v25.2" %} Enable automatic collection of [full statistics]({% link {{ page.version.version }}/cost-based-optimizer.md %}#full-statistics) for this table. | Boolean | `true` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using {% include_cached new-in.html version="v25.2" %} in a table does not render properly. See in:
https://deploy-preview-22087--cockroachdb-docs.netlify.app/docs/v25.2/with-storage-parameter#table-parame

| `sql_stats_automatic_collection_enabled` | Enable automatic collection of [full]({% link {{ page.version.version }}/cost-based-optimizer.md %}#full-statistics) and [partial]({% link {{ page.version.version }}/cost-based-optimizer.md %}#partial-statistics) statistics for this table. | Boolean | `true` |
| `sql_stats_automatic_collection_min_stale_rows` | Minimum number of stale rows in this table that will trigger a full statistics refresh. | Integer | 500 |
| `sql_stats_automatic_collection_fraction_stale_rows` | Fraction of stale rows in this table that will trigger a full statistics refresh. | Float | 0.2 |
| `sql_stats_forecasts_enabled` | Enable [forecasted statistics]({% link {{ page.version.version }}/show-statistics.md %}#display-forecasted-statistics) collection for this table. | Boolean | `true` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put this row in alphabetical order.

@taroface taroface merged commit 68fa5cc into main Feb 20, 2026
6 checks passed
@taroface taroface deleted the partial-stats branch February 20, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants